package com.atguigu.yygh.task.scheduled;

import com.atguigu.yygh.rabbitmq.RabbitService;
import com.atguigu.yygh.rabbitmq.constant.MqConst;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * ClassName: ScheduledTask
 * Package: com.atguigu.yygh.task.scheduled
 *
 * @Date: 2021/10/11 9:14
 * @author: 浪漫
 * @Description:
 */
@Component
@EnableScheduling
public class ScheduledTask {

    @Autowired
    private RabbitService rabbitService;

    //每天8点执行方法，就医提醒
    //cron表达式，设置执行间隔
    //0 0 8 * * ?
    @Scheduled(cron = "0/30 * * * * ?")
    public void taskPatient() {
        // 发送消息给 order模块中的rabbitmq监听器。
        // 封装msmvo信息再发送消息交给msm模块发送短信
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK,MqConst.ROUTING_TASK_8,"");
    }
}
